/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package visualisation;

import data.GameField.FieldState;
import java.awt.Color;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * Diese Klasse stellt Methode zur geeigneten farblichen
 * Darstellung des Spielfeldes bereit.
 */
class CellRenderer extends DefaultTableCellRenderer
{
	private final Color damageColor = new Color(201,53,3);
	private final Color shipColor = Color.lightGray;
	private final Color agressedColor = new Color(0,128,192);
	private final Color waterColor = new Color(0,0,128);
	
	private static final long serialVersionUID = 7534276495437156462L;

	/**Methode zum Setzen der Farbe in Assoziation zu einem Zustand
	 * @param Das Object value als zugewiesener Status*/
	@Override
	public void setValue( Object value )
	{
		if ( FieldState.Damage == ((FieldState)value))
		        setBackground(damageColor);
		else if ( FieldState.Ship == ((FieldState)value))
	        setBackground(shipColor);
	    else if ( FieldState.Agressed == ((FieldState)value))
	    	setBackground(agressedColor);
	    else
	        setBackground(waterColor);
	}
}
